/*
 * Copyright (c) 2025 EasyAdmin
 * All rights reserved.
 *
 * This file is part of the [EasAdmin] project.
 * Unauthorized copying of this file, via any medium, is strictly prohibited.
 * Proprietary and confidential.
 *
 * Author: EasyAdmin ( 1073602@qq.com )
 * Website: https://www.xhxiao.com
 */
package com.easy.module.system.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.easy.framework.common.validate.Add;
import com.easy.framework.common.validate.Update;
import com.easy.framework.database.entity.DefaultEntity;
import com.easy.framework.poi.annotation.Excel;
import com.easy.framework.poi.annotation.Option;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.Getter;
import lombok.Setter;

/**
 * 应用版本 实体
 *
 * @author EasyAdmin ( 1073602@qq.com )
 * @date 2025-08-20
 */
@Getter
@Setter
@TableName("sys_app_version")
public class SysAppVersion extends DefaultEntity {

    private static final long serialVersionUID = 1L;


    /**
     * 编号
     */
    @Excel(name = "编号")
    @NotNull(message="编号不能为空", groups = { Update.class  })
    @TableId(type = IdType.AUTO)
    private Long id;


    /**
     * 平台类型
     */
    @Excel(name = "平台类型")
    @NotBlank(message = "平台类型不能为空", groups = {Add.class, Update.class})
    @Size(message = "平台类型长度必须小于32个字", max = 32, groups = {Add.class, Update.class})
    private String platform;


    /**
     * 应用名称
     */
    @Excel(name = "应用名称")
    @NotBlank(message = "应用名称不能为空", groups = {Add.class, Update.class})
    @Size(message = "应用名称长度必须小于255个字", max = 255, groups = {Add.class, Update.class})
    private String appName;


    /**
     * 版本号
     */
    @Excel(name = "版本号")
    @NotBlank(message = "版本号不能为空", groups = {Add.class, Update.class})
    @Size(message = "版本号长度必须小于32个字", max = 32, groups = {Add.class, Update.class})
    private String version;


    /**
     * 包名
     */
    @Excel(name = "包名")
    @NotBlank(message = "包名不能为空", groups = {Add.class, Update.class})
    @Size(message = "包名长度必须小于64个字", max = 64, groups = {Add.class, Update.class})
    private String packageName;


    /**
     * 应用地址
     */
    @Excel(name = "应用地址")
    @NotBlank(message = "应用地址不能为空", groups = {Add.class, Update.class})
    @Size(message = "应用地址长度必须小于255个字", max = 255, groups = {Add.class, Update.class})
    private String url;


    /**
     * 大小（KB）
     */
    @Excel(name = "大小（KB）")
    private Integer size;


    /**
     * 版本后缀
     */
    @Excel(name = "版本后缀")
    @Size(message = "版本后缀长度必须小于255个字", max = 255, groups = {Add.class, Update.class})
    private String suffix;


    /**
     * 是否强制更新
     */
    @Excel(
            name = "是否强制更新",
            options = {
                    @Option(value = "0", name = "否"),
                    @Option(value = "1", name = "是")
            }
    )
    @NotNull(message = "是否强制更新不能为空", groups = {Add.class, Update.class})
    private Integer coerce;


    /**
     * 状态（0正常 1停用）
     */
    @Excel(
            name = "状态",
            options = {
                    @Option(value = "0", name = "正常"),
                    @Option(value = "1", name = "停用")
            }
    )
    @NotNull(message = "状态不能为空", groups = {Add.class, Update.class})
    private Integer status;


    /**
     * 更新日志
     */
    @Excel(name = "更新日志")
    @Size(message = "更新日志长度必须小于500个字", max = 500, groups = {Add.class, Update.class})
    private String remarks;

}